package com.qk.management.mapper;

import com.qk.entity.Dept;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @Author:zhengbowen
 * @Date: 2025/10/06 19:28
 * @Description:
 */
@Mapper
public interface DeptMapper {
    @Select("insert into dept(name,status,create_time,update_time) values(#{name},#{status},#{createTime},#{updateTime})")
    void insertDept(Dept dept);

    long selectCount(@Param("name") String name, @Param("status") Integer status);

    List<Dept> selectByPage(@Param("page") Integer page, @Param("pageSize") Integer pageSize, @Param("name") String name, @Param("status") Integer status);

    @Select("delete from dept where id=#{id}")
    void deleteDept(Integer id);

    @Select("select * from dept where id=#{id}")
    Dept selectDeptById(String id);

    @Select("update dept set name=#{name},status=#{status},update_time=#{updateTime} where id=#{id}")
    void updateDept(Dept dept);

    @Select("select * from dept")
    List<Dept> selectDeptsList();
}